package 笔试.华为.线上笔试;

import java.util.*;

// 65
public class 推荐好友 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int l = sc.nextInt();
        HashSet[] set = new HashSet[n + 1];
        for (int i = 1; i <= m; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (set[x] == null) {
                set[x] = new HashSet();
            }
            if (set[y] == null) {
                set[y] = new HashSet();
            }
            set[x].add(y);
            set[y].add(x);
        }
//        for (int i = 1; i < set.length; i++) {
//            System.out.println(i + " " + set[i]);
//        }

        HashSet friend = set[k];
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 1; i <= n; i++) {
            if (i == k) {
                continue;
            }
            if (set[i].contains(k)) {
                continue;
            }
            if (set[i] == null) {
                map.put(i, 0);
                continue;
            }
            map.putIfAbsent(i, 0);
            for (Object o : friend) {
                if (set[i].contains(o)) {
                    map.put(i, map.getOrDefault(i, 0) + 1);
                }
            }
        }
//        System.out.println(map);
        ArrayList<Map.Entry> list = new ArrayList<>(map.entrySet());
        list.sort(((o1, o2) -> {
            if (o1.getValue() != o2.getValue()) {
                return -((int) o1.getValue() - (int) o2.getValue());
            } else {
                return (int) o1.getKey() - (int) o2.getKey();
            }
        }));
        int i = 0;
        while (i < list.size() && i < l) {
            if (i != l - 1) {
                System.out.printf("%d ", (int) list.get(i).getKey());
            } else {
                System.out.println((int) list.get(i).getKey());
            }
            i++;
        }
        while (i < l) {
            if (i != l - 1) {
                System.out.print("0 ");
            } else {
                System.out.println(0);
            }
            i++;
        }
    }
}
